package com.yikome.purchase.enums;

/**
 *已创建(0) | 已派单(10) | 已完成(20) | 已取消(-10)
 */
public enum PurchaseStatus {

	PURCHASE_CREATE(0 , "已创建") , 
	
	PURCHASE_ASYNC(10 , "已派单") , 
	
	PURCHASE_OK(20 , "已完成"),
	
	PURCHASE_CANCEL(-10 , "已取消");
	
	
	private int status ; 
	private String statusName ;
	
	private PurchaseStatus (int status , String statusName) {
		this.status = status; 
		this.statusName = statusName;
	}

	public int getStatus() {
		return status;
	}

	public String getStatusName() {
		return statusName;
	}
	
	public static PurchaseStatus OrderStatusByStatus(int status) {
		PurchaseStatus[] statues = PurchaseStatus.values();
		for (PurchaseStatus _status : statues) {
			if(_status.getStatus() == status) {
				return _status;
			}
		}
		return null;
	}
}
